<?php
namespace Admin\Controller;
// use Think\Controller;
use Admin\Common\CommonController;
class AnswerController extends CommonController{
    public function listAction(){
        $sql="select * from answer ";
        $count_sql = "select count(*) as count from answer";
        $data_m=M();
        $res = $data_m->query($sql);
        $count_res=$data_m->query($count_sql);
        $count_res = current($count_res);
    	// var_dump($count_res);
    	// exit();
        $this->assign('res',$res);
        $this->assign('count_res',$count_res);
    	$this->display();
    }

    //删除评论
    public function delAction(){
        $answerId=I('post.aid');
        $sql="delete from answer where id='$answerId'";
        $data_m=M();
        $res=$data_m->execute($sql);
        $arr = array('success' => $res);
        echo json_encode($arr);
    }
}
?>